from typing import *

class Solution:
    def getMaxGridHappiness(self, m: int, n: int, introvertsCount: int, extrovertsCount: int) -> int:

        def f(index,pre,inCount,exCount):
            if index == m :
                return 0
            for i in range()

        return f(0,0,introvertsCount,extrovertsCount) # 0 ， hash